//
//  TemplateFloorFocusModel.m
//  MVP_DesignModel_OCVersion
//
//  Created by DeLongYang on 2017/7/21.
//  Copyright © 2017年 DeLongYang. All rights reserved.
//

#import "TemplateFloorFocusModel.h"
#import "TemplateJumpAction.h"  // 加入 新的跳转的actionModel
#import "TemplatePicModel.h"

@implementation TemplateFloorFocusModel

#pragma mark ---- MJ_KeyValue Delegate
+ (NSDictionary *)mj_replacedKeyFromPropertyName
{
    return  @{
              @"itemList":@"picList"
              };

}

// 使用 templatePicModel 来进行解析
+ (NSDictionary *)mj_objectClassInArray
{
    return  @{
              @"itemList":@"TemplatePicModel"
              };
}


#pragma mark ---- TemplateContainerProtocol

- (id<TemplateRenderProtocol>)childModeAtIndex:(NSInteger)index
{
    if (self.margin&&(index+1) == [self numberOfChildModelsInContainer]) {
        return self.margin;
    }
    return self;
}

- (NSInteger )numberOfChildModelsInContainer
{
    NSInteger rows = 0;
    if (self.margin) rows++;
    if (self.itemList) rows++;
    return rows;

}

#pragma mark ----  TemplateRenderProtocol

- (NSString *)floorIdentifier
{
    return  @"TemplateFocusCell";
}


#pragma mark ----  TemplateActionProtocol

- (TemplateAction *)actionAtIndexPath:(NSIndexPath *)indexPath
{
    NSUInteger position = [indexPath indexAtPosition:0];
    if (position<self.itemList.count) {
        
        TemplatePicModel *picModel = self.itemList[position];
        TemplateJumpAction *action = [[TemplateJumpAction alloc] init];
        action.jumpToType = templateJumpToActivityM;
        action.jumpToUrl = picModel.jump.url;
        action.eventId = @"GeneralChannel_BannerPic";
        return action;

    }
    
    return  nil;
}





@end




























































